window.addEventListener('load',function(){
    //获取元素
    let li = document.querySelectorAll('.min-title li')
    let content = document.querySelectorAll('.content>div')
   /*  let infor = document.querySelector('.content .information')
    let threeBox = document.querySelector('.content .three-box')
    let success = document.querySelector('.content .success') */
    //获取按钮
  /*  let agree = document.querySelector('.three-box input')
   let submit =document.querySelector('.information .mation-box .tijiao') */
  
        
    /*agree.addEventListener('click',function(){
            
            threeBox.style.display="none"
            infor.style.display="block"
            
            
        })
        submit.addEventListener('click',function(){
            infor.style.display='none'
            success.style.display='block'
           
        })
        */  
      
    
        
 li.forEach(function(item,index){
   item.addEventListener('click',function(){
       li.forEach(function(value){
       value.classList.remove('active')
      })
      item.classList.add('active')
   
   content.forEach(function(it){
        
        it.classList.remove('e')
        content[index].classList.add('e')
        })
      })

}) 


let nameCheck = document.querySelector('.nameCheck')

//验证姓名字段
nameCheck.addEventListener('blur',function(){

    let reg = /^[\u4e00-\u9fa5]{2,6}$/;
    let name = $("#name").val();
    if (!reg.test(name) || name=='') {
        $(".name").html("<span class='red'>请输入2~6位中文</span>");
        return false;
    }else{
        $(".name").text('√');
        return true;
    }
})


//验证密码
let pwdCheck = document.querySelector('.pwdCheck')
pwdCheck.addEventListener('blur',function(){
    let reg = /^[\s\S]{6,12}/;
    let pwd = $("#pwd").val();
    if(!reg.test(pwd) || pwd==''){
        $(".pwd").html("<span class='red'>请输入6-12位密码</span>")
        return false;
    }else{
        $(".pwd").text('√');
        return true;
    }
})
 //确认密码
 let pwdSure =  document.querySelector('.pwdSure')
 pwdSure.addEventListener('blur',function(){
    if ($("#pwd").val() === $("#pwd1").val()) {
        return true;
    } else {
        $(".pwd1").html("<span class='red'>两次密码输入不一致</span>")
        return false;
    }
 })
 //邮箱
 let mail = document.querySelector('.mail')
 mail.addEventListener('blur',function(){
    let reg = /^\w{3,12}@\w{1,5}\.[a-z]{2,3}$/;
    let email = $("#email").val();
    if(!reg.test(email) || email==''){
        $(".email").html("<span class='red'>请输入正确的邮箱</span>")
        return false;
    }else{
        $(".email").text('√');
        return true;
    }
 })
 //验证手机号
 let tel = document.querySelector('.tel')
 tel.addEventListener('blur',function(){
    let reg = /^\d{11}$/;
    let tel = $("#tel").val();
    if(!reg.test(tel) || tel==''){
        $(".tel").html("<span class='red'>请输入11位电话号码</span>")
        return false;
    }else{
        $(".tel").text('√');
        return true;
    }
 })




})
   
    






/* $(function(){
    //初始化插件
    $('.mation-box').validate({
        //验证规则
        rules:{
            user:{
                required:true,
                isUser:true
            },
            pwd:{
                required:true,
                isPwd:true
            },
            checkPwd:{
                equlTo:"#pwd"
            }

        },


        
        //错误提示信息
        messages:{
           user:{
             required:"请输入姓名"
           },
           pwd:{
               required:"请输入密码"
           },
           checkPwd:{
               equalTo:"两次密码不一致"
           }
        }
    })
  
}) */



 




